package com.ffyc.cemp.tools;

import com.huaban.analysis.jieba.JiebaSegmenter;

import java.util.Iterator;
import java.util.List;

/**
 * 分词工具类
 */
public class WorldUtil {
    public static List<String> toWorlds(String sentence){
        JiebaSegmenter js=new JiebaSegmenter();
        //sentence.replaceAll("[\\\\pP\\\\p{S}的得呢了啊吗和]|[0-9]]","");
        //return js.sentenceProcess(sentence);
        List<String>list=js.sentenceProcess(sentence);//迭代器删除
        Iterator<String>it=list.iterator();
        while (it.hasNext()){
            String str= it.next();
            if(str.matches("[\\\\pP\\\\p{S}的得呢了啊吗和]|[0-9]]")){
                it.remove();

            }
        }
        return list;
    }
}
